package board;

import sgfRead.SgfPosition;

/**
 * 
 * @author vie27115
 * 
 *         This class is for keeping information about position on board of go.
 */

public class GoPosition {
	public static final int _BLACK = 0;
	public static final int _WHITE = 1;
	public static final int _EMPTY = 2;
	private int type; // or black or white.
	private int x;
	private int y;

	private char a;
	private char b;

	public GoPosition(int i, int j) {
		this.x = i;
		this.y = j;
		this.a = (char) (i + 'a');
		this.b = (char) (i + 'b');
		this.type = _EMPTY;
	}

	public GoPosition(char a, char b) {
		this.a = a;
		this.b = b;
		this.x = a - 'a';
		this.y = b - 'a';
		this.type = _EMPTY;
	}

	public GoPosition(SgfPosition pos) {
		this.a = pos.getA();
		this.b = pos.getB();
		this.x = a - 'a';
		this.y = b - 'b';
	}

	public void setPosition(int x, int y) {
		this.x = x;
		this.y = y;
	}

	public int getType() {
		return type;
	}

	public void setBlack() {
		this.type = _BLACK;
	}

	public void setWhite() {
		this.type = _WHITE;
	}

	public void setEmpty() {
		this.type = _EMPTY;
	}

	public boolean isBlack() {
		return (type == _BLACK);
	}

	public boolean isWhite() {
		return (type == _WHITE);
	}

	public boolean isEmpty() {
		return (type == _EMPTY);
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

	public char getA() {
		return a;
	}

	public char getB() {
		return b;
	}
}
